
import com.etop.weibo.beans.StarAndFan;
import com.etop.weibo.beans.User;
import com.etop.weibo.dao.DAOFactory;
import com.etop.weibo.util.HibernateUtil;
import java.util.List;
import org.hibernate.Session;
import org.junit.Test;

/**
 *
 * @author jansing
 */
public class StarAndFanCRUD {

    public void list02(){
        List<User> list = DAOFactory.getStarAndFanDao().fansList(1);
        System.out.println(list);
        System.out.println(list.size());
//        for(User user : list){
//            System.out.println(user.getUsername() + "   " + user.getPassword());
//        }
    }
   
    public void list01(){
        List<User> list = DAOFactory.getStarAndFanDao().starsList(1);
        for(User user : list){
            System.out.println(user.getId() + "   " + user.getUsername() + "   " + user.getPassword());
        }
    }
    
    @Test
    public void delete01(){
        DAOFactory.getStarAndFanDao().delete(3, 1);
    }
    
    public void add02() {
        for (int i = 0; i < 100; i++) {
            StarAndFan sf = new StarAndFan();
            sf.setFanId(1);
            sf.setStarId(i);
            DAOFactory.getStarAndFanDao().add(sf);
        }
    }

    public void add01() {
        StarAndFan sf = new StarAndFan();
        sf.setFanId(1);
        sf.setStarId(3);
        DAOFactory.getStarAndFanDao().add(sf);
    }
}
